var PeopleMedia = PeopleMedia || {};

PeopleMedia.OnLoad = new function () {

    if (typeof (autorefresh) == 'undefined') { autorefresh = false; }

    this.on_load_events = function (sessionid) {
        // put focus() on starting place for forms
        if (document.forms[0]) {
            if (document.forms[0].username && document.forms[0].username.type == 'text') {
                document.forms[0].username.focus();
            } else if (document.forms[0].email && document.forms[0].email.type == 'text') {
                document.forms[0].email.focus();
            } else if (document.forms[0].subject && document.forms[0].subject.type == 'text') {
                document.forms[0].subject.focus();
            }
        }

        //timeout popup 900,000 = 15 minutes
        setTimeout("PeopleMedia.OnLoad.CountDown('" + sessionid + "')", 900000);

    };

    //timeout countdown
    this.CountDown = function (sessionid) {
        if (sessionid == undefined) {
            sessionid = '';
        }
        if (typeof (sn) != 'undefined') {
            if (autorefresh == true) {
                setTimeout("PeopleMedia.OnLoad.CountDown('" + sessionid + "')", 900000);
            } else {
                window.confirm(sn + "\nYour session will expire in 5 minutes. Click OK to continue.");
                setTimeout("PeopleMedia.OnLoad.CountDown('" + sessionid + "')", 900000);
            }
        }
    };
};